#include <vector>

using namespace std;

class Solution {
public:
    int superEggDrop(int K, int N) {
        vector<int> dp(K + 1);
        int m = 0;
        while (dp[K] < N) {
            m++;
            for (int k = K; k >= 1; k--) {
                dp[k] = dp[k - 1] + dp[k] + 1;
            }
        }
        return m;
    }
};